<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;


//动态设置路由

Route::get('p/:route', 'CustomPage/index');

// 合集
Route::get('api/collection/:i', 'Collection/get_collection')->cache(15);
Route::get('api/post_collection/:i', 'Collection/get_post_collection')->cache(15);

// clientarea
Route::get('clientarea', 'index/clientarea');

// 网站地图
Route::get('/sitemap.xml', 'index/sitemap');

// 游戏
Route::get('api/jinitaimei', 'game/add');

// 网页制作
Route::get('makepage', 'page/index');

// 登录/注册
Route::post('api/login', 'login/login')->middleware(\app\middleware\Log::class);
Route::post('api/register', 'register/register')->middleware(\app\middleware\Log::class);
Route::post('api/bcm_login', 'login/bcm_login')->middleware(\app\middleware\Log::class);

Route::post('api/set_bcm', 'user/set_bcmid')->middleware(\app\middleware\Log::class); //绑定编程猫账号

Route::post('api/set_info', 'user/set_info')->middleware(\app\middleware\Log::class); //设置账户信息

Route::post('api/set_pw', 'user/set_pw')->middleware(\app\middleware\Log::class);

// Code
Route::post('api/code/send', 'code/send')->middleware(\app\middleware\Log::class);
Route::post('api/code/accept', 'code/accept')->middleware(\app\middleware\Log::class);

// 上传
Route::post('api/upload/', 'upload/index');
Route::post('api/upload/add', 'upload/add');
Route::get('upload/view/:i', 'upload/view');
Route::get('file/:i', 'upload/file')->cache(60);

// 管理
Route::get('admin/', 'admin/index');
Route::get('admin/page', 'admin/page');
Route::rule('admin/api/:path', 'admin/apilod');
Route::get('admin/api/get_template', 'admin/get_template'); //获取模板列表

// 社区页面
Route::get('shequ/post/:id', 'shequ/post')->cache(15); // 首页
Route::get('user/:i', 'user/index')->cache(15); // 用户
Route::get('post/:id', 'shequ/post')->cache(15); // 帖子
Route::get('shequ/sendpost', 'shequ/sendpost')->cache(15); // 发帖
Route::get('change_post/:p', 'shequ/change_post')->cache(15); // 编辑帖子页面
Route::get('api/shequ/change_post/', 'shequ/change_post_api'); // 编辑帖子接口
Route::post('api/shequ/change_post/', 'shequ/change_post_api'); // 编辑帖子接口

// 社区API
Route::post('api/shequ/send_post', 'shequ/send_post'); // 发送
Route::post('api/shequ/send_talk', 'shequ/send_talk')->middleware(\app\middleware\Log::class);

Route::get('api/shequ/get_post/:i', 'shequ/get_post')->cache(5); // 获取

Route::get('api/user/get_group/:i', 'user/get_group')->cache(60); // 获取用户组信息
Route::get('api/shequ/get_talk/:i', 'shequ/get_talk');
Route::get('api/shequ/get_user/:i', 'shequ/get_user')->cache(20);
Route::get('api/shequ/get_post_list/:p/:i', 'shequ/get_post_list');
Route::get('api/shequ/search_post/:p', 'shequ/search_post')->cache(15); // 搜索帖子
Route::post('api/shequ/search_post/:p', 'shequ/search_post'); // 搜索帖子
Route::get('api/shequ/get_home_post_list', 'shequ/get_home_post_list')->cache(15);

Route::get('api/shequ/get_post_partition', 'shequ/get_post_partition')->cache(30); // 获取帖子分区

Route::post('api/shequ/del_post', 'shequ/del_post'); // 删除
Route::get('api/shequ/setgoods/:i', 'shequ/setgoods'); // 点赞
Route::get('api/shequ/unsetgoods/:i', 'shequ/unsetgoods'); // 取消点赞

Route::post('api/shequ/get_posts', 'user/get_posts'); //获取个人帖子

Route::get('api/user/get_status', 'user/get_status'); // 获取当前登录用户信息
Route::get('api/user/protect_user', 'user/protect_user'); // 保护当前账号

// Imgverify
Route::post('api/imgverify/make', 'imgverify/make'); // 建造
Route::post('api/imgverify/check', 'imgverify/check'); // 检查答案
Route::post('api/imgverify/check_again', 'imgverify/check_again'); // 检查是否完成

// CoCoApi
Route::get('api/coco', 'coco/index')
    ->allowCrossDomain([
        'Access-Control-Allow-Origin' => '*'
    ]);

// 安装API
Route::get('install/write/:a/:b/:c/:d', 'install/write');

// 获取消息API
Route::get('api/get_message', 'message/get_message');
